//试剂瓶
Bottle = Widget.extend({
	runningAction:null,
	ctor:function(){
		this._super();
		this.init();
		this.setTag(TAG_BOTTLE_ALL);
	},
	init:function(){

		this.body = new Button(this, 10, TAG_BOTTLE, "#bottle.png", this.callback,this);
		
		var lid=new Button(this,9,TAG_LID,"#lid.png",this.callback,this);
		lid.setPosition(this.body.width*0.01,this.body.height*0.45);
		
		var flow=new Button(this.body,10,TAG_FLOW,"#flow_right.png",this.callback,this);
		flow.setRotation(80);
		flow.setAnchorPoint(cc.p(1, 1));
		flow.setPosition(cc.p(this.body.width*0.25,this.body.height*0.98));
		flow.setOpacity(0);
		
	},
	show:function(){
		var fadein=cc.fadeIn(0.1);
		var rotate=cc.rotateBy(1,5);
		var fadeout=cc.fadeOut(0.1);
		var flow=this.body.getChildByTag(TAG_FLOW);
		flow.runAction(cc.sequence(fadein,rotate,fadeout));
	},
	callback:function(p){
		var func=cc.callFunc(function() {
			gg.flow.next();
		}, this);
		switch (p.getTag()) {
		case TAG_LID:
			var ber=cc.bezierBy(1, [cc.p(10, 25),cc.p(20, 45),cc.p(45, -45)]);
			var rotate=cc.rotateBy(1,180);
			p.runAction(cc.sequence(cc.spawn(ber,rotate),func));
			break;
		case TAG_BOTTLE:
			var ber =cc.bezierBy(1, [cc.p(-25,35),cc.p(-55,80),cc.p(-70, 110)]);
			var rotate=cc.rotateBy(1,-85);
			var cylinder=ll.run.getChildByTag(TAG_CYLINDER_ALL);
			var lid=this.getChildByTag(TAG_LID);
			p.runAction(cc.sequence(ber,cc.spawn(rotate,cc.callFunc(function() {
				cylinder.rotate();
			}, this),cc.sequence(cc.delayTime(0.85),cc.callFunc(function() {
				cylinder.showFilm();
				this.show();
			},this))),cc.delayTime(2),cc.spawn(rotate.reverse(),cc.callFunc(function() {
				cylinder.rotate1();
			}, this)),cc.callFunc(function() {
				cylinder.show();
			}, this),cc.callFunc(function() {
				this.body.setVisible(false);
				lid.setVisible(false);
			},this),func));
			break;
		default:
			break;
		}
	}
});